package org.gw.ylc.base.model;

import org.gw.ylc.base.util.CryptoUtils;
import org.hibernate.annotations.GenericGenerator;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;

/**
 * 用于信息扩展表<br>
 * id varchar 40 否 主键UUID<br>
 * userId varchar 40 是 用户/登录名（取学生表学号、管理员表工号）<br>
 * password varchar 512 是 密码<br>
 */
@Entity
public class UserInfoExt {
	@Id
	@Column(length = 40)
	@GeneratedValue(generator = "uuid")
    @GenericGenerator(name = "uuid", strategy = "uuid")
	private String id;

	@Column(length = 40)
	private String userId;

	@Column(length = 512)
	private String password;

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getUserId() {
		return userId;
	}

	public void setUserId(String userId) {
		this.userId = userId;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		try {
			this.password = CryptoUtils.createSHA512Hash(password, null);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

}
